﻿using ProjectCloth.Entity;
using ProjectCloth.WpfUI.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ProjectCloth.WpfUI
{
    /// <summary>
    /// Interaction logic for SaleOrderUc.xaml
    /// </summary>
    public partial class SaleOrderUc : UserControl
    {
        private int _size = 0;
        private ClothContext db;
        private List<SaleOrderItem> orderList = new List<SaleOrderItem>();
        private List<SaleOrderItemView> orderListView = new List<SaleOrderItemView>();
        public List<Product> productList = new List<Product>();
        public SaleOrderUc(int size)
        {
            _size = size;
            InitializeComponent();
            db = new ClothContext();
            productList = db.Products.ToList();
            Dictionary<int, string> dictionary = new Dictionary<int, string>();

            productList.ForEach(o => dictionary.Add(o.Id, o.ProductNo));
            var vieworder = new SaleOrderItemView()
            {
                Value = dictionary
            };
            orderListView.Add(vieworder);
        }
        public void Init()
        {
            if (_size == 1)
            {
                orderNameLab.Content = "大货单";
            }

           
        }

        private void SaleOrderItemDg_Loaded(object sender, RoutedEventArgs e)
        {
           
        }

        //public static implicit operator SaleOrderUc(SaleOrderUc v)
        //{
        //    throw new NotImplementedException();
        //}
    }
}
